package org.jeecg.modules.demo.hd.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.demo.hd.entity.AppMyProjectClickdetail;
import org.jeecg.modules.demo.hd.entity.AppUserCashCashoutDetail;
import org.jeecg.modules.demo.hd.mapper.AppUserCashCashoutDetailMapper;
import org.jeecg.modules.demo.hd.service.IAppUserCashCashoutDetailService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: 用户提现申请
 * @Author: jeecg-boot
 * @Date: 2025-05-17
 * @Version: V1.0
 */
@Service
public class AppUserCashCashoutDetailServiceImpl extends ServiceImpl<AppUserCashCashoutDetailMapper, AppUserCashCashoutDetail> implements IAppUserCashCashoutDetailService {


    @Override
    public Integer getCashOutDetailCount(String userId) {
        String day = DateUtils.getDate("yyyy-MM-dd");
        LambdaQueryWrapper<AppUserCashCashoutDetail> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.apply("DATE_FORMAT(create_time,'%Y-%m-%d') = DATE_FORMAT({0},'%Y-%m-%d')", day);
        queryWrapper.eq(AppUserCashCashoutDetail::getUserId, userId);
        int i = this.baseMapper.selectCount(queryWrapper).intValue();
        return i;
    }
}
